import 'style-loader!css-loader!../../../css/kfm_reset_css.css';
import 'style-loader!css-loader!../../../css/file_upload.css';
import file_upload from './file_upload.js';
import typeManger from '../uploadTypeComponent/typeManger.js';
import Vue from 'vue/dist/vue.js';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

window.onload = function () {
    console.log('upload\n\n\n\n\n');
    new Vue(file_upload.root);
};

let routerConfig = {
    router:null,
    customRoutes:[]
};

let routerFun = function () {
    /*绝大部分跟vue-router有关的函数,都在这里面*/
    /*最终返回一个VueRouter实例*/
    let getChildren = function () {
        /*给routes的children属性提供数据*/
        let children = [];
        for(let i=0;i<typeManger.length;i++){
            children.push({
                path:typeManger[i].name,
                component:typeManger[i].component
            })
        }
        return children;
    };

    return new VueRouter({
        routes:[{
            path:'/',component:file_upload.root,
            children:getChildren()
        }]
    });
};

routerConfig.router = routerFun();
new Vue({router:routerConfig.router}).$mount('#file_upload');